package p1;

/**
 * Created with IntelliJ IDEA.
 * Description:基于lambda表达式,匿名内部类的目的不是为了写一个类,而是为了写run方法
 * User: LianBao
 * Date: 2024-06-07
 * Time: 14:14
 */
public class demo5 {
    public static void main(String[] args) throws InterruptedException {


        Thread t = new Thread(() -> {
            while (true) {
                System.out.println("Hello Thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });


        t.start();
        while (true) {
            System.out.println("Hello Main");
            Thread.sleep(1000);
        }
    }
}
